
<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <title>好评返现</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <#include "setwxshare.ftl"/>
    <link href="${resources}/css/20160820/upload.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
    <div class="header">上传好评返现图片</div>

    <div class="tip">选择图片：</div>

    <div id="uploadImg"></div>

    <a href="javascript:void(0)" id="submit">提交</a>
</div>

<script src="${resources}/scripts/20160820/jquery-2.2.2.min.js"></script>
<script src="${resources}/scripts/20160820/plupload.full.min.js"></script>
<script src="${resources}/scripts/20160820/common.js"></script>
<script src="${resources}/scripts/20160820/plupload.js"></script>

<script>
var img=[];
	uploadImg.plupload({
	    container: "#uploadImg",
	    url: "${path}/upload/pic",
	    max: 1,
	    callback: function (data) {
	    	var image=[];
	    	for(var i in data){
	    		image.push(data[i]);
	    	}
	    	img=image;
	    }
	});
    $("#submit").on("click",function(){ 
		/*使用弹框*/
		if(img.length<($("#fileList").find(".imgPercent").length) && $("#fileList").find(".imgPercent").length>0){
			common.alert({content:"图片上传中，请稍等"});
			return;
		}	
		 if(img.length>0){
		    common.alert({
		        title: "温馨提示",
		        content: '确定提交吗?',
		        dialog: true,
		        width: "60%",
		      
		        
		        ok: function(){
		        	
		        	
		        	$.ajax({
		    			type:"post",
		    			data:{ 
		    				"pics":img
		    			 },
		    			url:"${path}/manage/member/returnCash",
		    			success:function(data){	
		    				if(data.code=='100'){
		    					common.alert({
			    			   		width:"60%",
			    				   	title:"提示信息",
			    				 	content:"图片上传提交成功",
			    				 	ok:function(){
			    				 		window.location.href="${path}/manage/member";
			    				 	}
			    			   	})
		    				}else{
		    					common.alert({
			    			   		width:"60%",
			    				   	title:"提示信息",
			    				 	content:"图片上传提交失败",
                                    ok:function(){
                                    	window.location.href="${path}/manage/member";
			    				 	}
			    			   	})
		    				}
		    			   	
		    				
		    			},error: function(XMLHttpRequest, textStatus, errorThrown) {
		    					
		    					common.alert({
			    			   		width:"60%",
			    				   	title:"提示信息",
			    				 	content:"网络异常"
			    			   	})
		                }
		    		})
		        }
		     });
		 }else{
			 common.alert({
			   		width:"60%",
				   	title:"提示信息",
				 	content:"选择图片才能提交"
			   	})
		 }
	})
    
</script>
</body>
</html>
 

 
